﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceProcess;
using Microsoft.Win32;
using System.Diagnostics;

namespace BackupService
{
    class Program
    {
        static void Main(string[] args)
        {
            //if (args != null && args.Length > 0)
            //{
            //    string path = System.Environment.CurrentDirectory + "\\BackupService.exe";
            //    Process p = new Process();
            //    p.StartInfo.FileName = "cmd.exe";
            //    p.StartInfo.UseShellExecute = false;
            //    p.StartInfo.RedirectStandardInput = true;
            //    p.StartInfo.RedirectStandardOutput = true;
            //    p.StartInfo.RedirectStandardError = true;
            //    p.StartInfo.CreateNoWindow = true;
            //    p.Start();
            //    if (args[0] == "install")
            //    {
            //        p.StandardInput.WriteLine("sc create BackupService binPath= " + path + " start= system");
            //        p.StandardInput.WriteLine("sc start BackupService");
            //    }
            //    else
            //    {
            //        p.StandardInput.WriteLine("sc delete BackupService");
            //    }
            //    return;
            //}
            ServiceBase.Run(new BackupService());
        }
    }
}
